<?php

	header("Content-Type: text/html;charset=utf-8");

	include("function/_nosql.php"); //

	include("function/function.php");
		if(!empty($_COOKIE['username'])||!empty($_COOKIE['password'])){//如果session为空，并且用户没有选择记录登录状
			$user_email = $_COOKIE['username'];
			$user_password = $_COOKIE['password'];
			$is_reguser = getNewsNums("kboy_user"," ( user_email='$user_email' or user_phone='$user_email' )  AND user_password='$user_password'");
			if($is_reguser >0){
				$_SESSION['kboy_user'] = $user_email;

				$_SESSION['kboy_userid'] = getClassName("kboy_user","uid","( user_email='$user_email' or user_phone='$user_email' )");

				$_SESSION['kboy_leader'] = getClassName("kboy_user","user_leader","( user_email='$user_email' or user_phone='$user_email' )");
				
				mysql_query("update kboy_user set user_lasttime='$THIS_TODAY_DATETIME',user_lastip='".getip()."' where ( user_email='$user_email' or user_phone='$user_email' )");
				
				echo "<script language=\"javascript\">location.href=\"user_index.php\";</script>";
			}
		}
	 //这段放在网站里


header("Pragma: no-cache");

$ua = strtolower($_SERVER['HTTP_USER_AGENT']);

$uachar = "/(symbianos|android|Mac OS|ucweb|blackberry)/i";

if($ua != '' && preg_match($uachar, $ua)){

echo '<script>window.location.href="http://www.chinawalking.net.cn/sj/login.php";</script>';

exit();

}


	$redirect_urls = urlencode($_SERVER['HTTP_REFERER']);
	
	if(isInclude($redirect_urls,'login.php')){
		$redirect_urls = 'index.php';
	}
	if(isInclude($redirect_urls,'reg.php')){
		$redirect_urls = 'index.php';
	}


?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>会员登录_<?= $web_titles ?></title>

<meta name="Keywords" content="会员登录,<?= $web_keywords ?>" />

<meta name="Description" content="<?= $web_description ?>" />
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<link rel="stylesheet" href="css/common.css"/>

<link rel="stylesheet" href="css/style.css"/>
<script type="text/javascript" src="js/baidutongji.js"></script>
<style type="text/css">
	@media screen and (min-width:1200px ) {
		.content{
			max-width: 1200px;
		}
	}
	@media screen and (max-width:1200px ) {
		.content{
			width: 100%;
		}
		.login-box{
			float: none;
			margin: auto;
		}
	}
	@media screen and (max-width:500px ) {
		.login-box{
			width: 90%;
			height: 500px;
		}
		.login-use-btn a{
			display: block;
			margin-bottom: 10px;
		}
		.login-head{
			padding: 0 0 10px;
		}
		.login-bd .login-use-btn .use-btn{
			padding: 0;
			width: 100%;
			text-align: center;
		}
		.login-head .logo{
			margin: auto;
		}
		.login-bd .login_chest{
			width: 70px!important;
		}
		.login-bd .f-login span a{
			display: none;
		}
		body{
			min-width: 100% !important;
		}
	}

</style>
<style type="text/css">

.login-wrap{

    width: 100%;

    height: 100%;

    overflow: hidden;

    background:url(<?=$index_mk1?>) no-repeat center center;

    background-size: cover;

}


</style>

</head>

<body>

    <div class="login-wrap">

        <div class="content pb35">

			<? include("_include.login.head.php") ?>

            <div class="login-box">

                <div class="title">欢迎登录中国徒步网</div>

				<form name="loginform" id="loginform" method="post" action="chklogin.php?action=chklogin">

				<input type="hidden" name="redirect_urls" id="redirect_urls" value="<?=$redirect_urls?>" />

                <div class="login-bd">

                    <div class="f-login-hd"><h3>登录</h3><a href="reg.php">没有账号？注册</a></div>

                    <div class="f-login">

                        <input name="user_email" id="user_email" value="" type="text" placeholder="Email或手机号" class="login-input login_name">

                    </div>

                    <p class="username_text"></p>

                    <div class="f-login">

                        <input name="user_password" id="user_password" value="" type="password" placeholder="密码" class="login-input login_password">

                    </div>

                    <p></p>

                    <div class="f-login">

                        <input name="user_passcode" id="user_passcode" value="" type="text" placeholder="验证码" class="login-input login_chest">

                        <span class="yzm"><img src="function/code.php" width="103" height="35" class="imgCode reshCode"/></span>

                        <span><a href="javascript:void(0);" class="reshCode">看不清？？</a></span>

                    </div>

                    <div class="f-login-bd">

                        <span class="auto-login"><label><input type="checkbox" name="zidong" value="1"/>自动登录</label></span>

                        <span class="find-password"><a href="getpwd_guid.php">找回密码</a></span>

                    </div>

                    <div class="login-btn"><input type="submit" name="basic-btn" class="basic-btn" value="登录" /></div>

                    <div class="login-use-btn"><a href="api/oauth/" class="use-btn use-qq" target="_blank">用QQ账号登录</a><a href="api/weibo/" class="use-btn use-sina" target="_blank">用微博账号登录</a></div>

                </div>

				</form>

            </div>

            <div class="clearfix"></div>

            <div class="recommend-line">

                <div class="line-label">路线推荐</div>

                <div class="line-show">

                    <div class="bd">

                        <ul class="infoList">

						<?php

								$news_sql = "select * from kboy_forum_active order by active_top desc,active_order desc, id desc limit 5";

								$news_rows = mysql_query($news_sql);

								while($news_rs = mysql_fetch_array($news_rows)){

									echo "<li><a href=\"activeview.php?newsid=".$news_rs['id']."\" target=\"_blank\">".$news_rs['active_title']."</a></li>";

								}

						?>

<!--                            <li><a href="#">蜕变之旅 朝圣梅里大转山 赠HASKI千元礼包</a></li>

                            <li><a href="#">农场摘菜不如在线学外语好玩农场摘菜不如在线学外语好玩农场摘菜不如在线学外语好玩</a></li>

                            <li><a href="#">数理化老师竟也看学习资料？</a></li>

                            <li><a href="#">学外语，上北外！</a></li>

                            <li><a href="#">那些无法理解的荒唐事</a></li>

-->                        </ul>

                    </div>

                </div>

                <div class="close"><img src="images/close.png" width="21" height="21" alt=""/></div>

            </div>

        </div>

        <!--版权信息-->

		<? include("_include.login.copyright.php") ?>

    </div>

    <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>

    <script type="text/javascript" src="js/jquery.SuperSlide.2.1.1.js"></script>

    <script type="text/javascript" src="js/login.js"></script>

	<script language="javascript">

	$(document).ready(function(){

		// 刷新验证码

		$(".reshCode").click(function(){

			$(".imgCode").attr("src","function/code.php?nums=" + Math.random());   

		});

		

		// 表单提交

		$("#loginform").submit(function(){

			var user_email = $("#user_email").val();

			var user_password = $("#user_password").val();

			var user_passcode = $("#user_passcode").val();

			

			// 用户名验证

			if(user_email.replace(/\ /g,"").length<1){

				alert("Email或手机号不能为空！");

				$("#user_email").focus();

				return false;

			}
			
			// 密码验证

			if(user_password.replace(/\ /g,"").length<1){

				alert("密码不能为空！");

				$("#user_password").focus();

				return false;

			}

			// 验证码验证

			if (user_passcode.replace(/\ /g,"").length<1){

				alert("请正确输入验证码！");

				$("#user_passcode").focus();

				return false;

			}

			if (isNaN(user_passcode.replace(/\ /g,""))){

				alert("请正确输入验证码！");

				$("#user_passcode").focus();

				return false;

			}

		});

		

	});

	</script>

</body>

</html>

